import request from '@/router/axios'

export function fetchList(query) {
  //alert("获取查询条件----"+JSON.stringify(query))
   if(query!=null && query.ticketTypeEn==''){	    
	     delete query.ticketTypeEn;
    }  
   if(query!=null && query.ticketTypeParamEn==''){	  
		delete query.ticketTypeParamEn;
	}
  //alert("获取查询条件-3333333---"+JSON.stringify(query));
  return request({
    url: '/stm/swststock/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/stm/swststock',
    method: 'post',
    data: obj
  })
}

export function updateSwStStock(obj,checkDate) {
  return request({
    url: '/stm/swststock/updateSwStStock?checkDate=' + checkDate,
    method: 'post',
    data: obj,checkDate
  })
}

export function generateReport(obj) {
  return request({
    url: '/stm/swststock/generateReport',
    method: 'post',
    data: obj
  })
}

export function downTemplate() {
  return request({
    url: '/stm/swststock/downTemplate',
    method: 'post',
    responseType:'blob'
  })
}

export function getObj(id) {
  return request({
    url: '/stm/swststock/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/stm/swststock/' + id,
    method: 'delete'
  })
}

export function delBatch(id) {
  return request({
    url: '/stm/swststock/delBatch',
    method: 'delete',
    data:id
  })
}

export function putObj(obj) {
  return request({
    url: '/stm/swststock',
    method: 'put',
    data: obj
  })
}

export function importBatch(body) {
  return request({
    url: '/stm/swststock/importExcel',
    headers: {"Content-Type": "multipart/form-data"},
    method: 'post',
    data: body
  })
}

export function exportExcel(query) {
  return request({
    url: '/stm/swststock/export',
    method: 'get',
    params: query,
    responseType: 'arraybuffer'
  })
}


export function confirmObj(obj) {
  return request({
    url: '/stm/swststock/confirm',
    method: 'put',
    data: obj
  })
}

export function getTypeValue(query) {
  return request({
    url: '/admin/dict/type/check_day',
    method: 'get',
    params: query
  })
}

//查看库存日报表历史记录
export function queryRecords(param){
  return request({
    url: '/stm/swststock/getLogById/'+param.id,
    method: 'get'
  })
}

